package com.cute4j.diffs.javaswing;

import java.awt.GridLayout;

import javax.swing.BoundedRangeModel;
import javax.swing.DefaultBoundedRangeModel;
import javax.swing.JFrame;
import javax.swing.JProgressBar;
import javax.swing.JScrollBar;
import javax.swing.JSlider;
import javax.swing.SwingUtilities;

/**
 * Model View Controller.
 */
public class MVC {

  public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        JFrame frame = new JFrame("MVC");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        GridLayout layout = new GridLayout(3, 1, 8, 8);
        frame.getContentPane().setLayout(layout);
        BoundedRangeModel model =
            new DefaultBoundedRangeModel(50, 0, 0, 100);
        frame.getContentPane().add(new JSlider(model));
        frame.getContentPane().add(new JProgressBar(model));
        JScrollBar scrollBar =
            new JScrollBar(JScrollBar.HORIZONTAL);
        scrollBar.setModel(model);
        frame.getContentPane().add(scrollBar);
        frame.setBounds(100, 100, 200, 100);
        frame.setVisible(true);
      }
    });
  }

}
